/**
 * Saving account class, extends the abstract 
 * Account parent class.
 * @author Kristopher Gooding/Kyle Scharnhorst
 * @version 4/25/2014
 */
public class SavingsAccount extends Account {

	/**intrest rate for the savings account.*/
	private static double my_interest_rate = 1.25;

	/**
	 * constructor for the savings account.
	 * @param the_name
	 * @param the_street
	 * @param the_zip_code
	 * @param the_town
	 * @param the_country
	 */
	public SavingsAccount(final String the_name, final String the_street,
			final String the_zip_code, final String the_town,
			final String the_country) {
		super(the_name, the_street, the_zip_code, the_town, the_country);
		my_account_number = my_next_account_number;
		my_next_account_number++;
	}

	/**
	 * constructor for a simple savings acount. 
	 * used for testing.
	 * @param the_account_number
	 */
	public SavingsAccount(final int the_account_number) {
		super(the_account_number);
		my_account_number = the_account_number;
	}

	/**
	 * calculates the the interest for the account over time.
	 */
	public void calculateInterest() {
		my_balance = my_balance + (my_balance * my_interest_rate / 100);
	}

	/**
	 * method to withdraw money from the account.
	 * @param the_amount
	 * @return boolean representation of the success of the 
	 * transaction.
	 */
	public boolean withdrawal(final double the_amount) {
		if (((my_balance - the_amount) < 0)) {
			return false;
		} else {
			my_balance = my_balance - the_amount;
			return true;
		}
	}

	/**
	 * method to tranfer money into the savings account.
	 * @param the_amount
	 */
	public void verseMoney(final double the_amount) {
		my_balance += the_amount;
	}

}
